<template>
	<div class="p-policy">
		<!-- 政策申报——个人-用户信息 -->
		<v-info :resource="resource"></v-info>

		<div class="p-policy-content">
			<div class="company-policy-content">
				<div class="company-policy-head flexItems">
					<!-- 已申报政策数 -->
					<div class="company-policy-head-num flexItems">
						{{$t('common.company.declared')}}
						<span>{{count.applyPolicyNum}}</span>
					</div>
					<!-- 申报总人次 -->
					<div class="company-policy-head-num flexItems">
						{{$t('common.company.totalPerson')}}
						<span>{{count.applyNum}}</span>
					</div>
					<!-- 已兑现人次 -->
					<div class="company-policy-head-num flexItems">
						{{$t('common.company.cashedPerson')}}
						<span>{{count.cashInNum}}</span>
					</div>
					<!-- 待兑现人次 -->
					<div class="company-policy-head-num flexItems">
						{{$t('common.company.dcashedPerson')}}
						<span>{{count.toCashInNum}}</span>
					</div>
					<!-- 未兑现人次 -->
					<div class="company-policy-head-num flexItems">
						{{$t('common.company.outstandingPerson')}}
						<span>{{count.noCashInNum}}</span>
					</div>
				</div>
				<div class="company-policy-table">
					<div class="company-release-table">
						<table>
							<tr>
								<td></td>
								<td class="zmlleft">{{$t('common.company.applicationItems')}}</td>
								<td>
									<span class="zmlchange" @click="bindChange">
										{{$t('common.company.applicationSubmissionTime')}} 
										<i class="el-icon-d-caret" v-if="sort == 1"></i>
										<i class="el-icon-caret-bottom" v-else-if="sort == 2"></i>
										<i class="el-icon-caret-top" v-else></i>
									</span>
								</td>
								<td>{{$t('common.policy.materialCount')}}</td>
								<td>{{$t('common.policy.status')}}</td>
							</tr>
							<tr v-for="item in tableData" :key="item.id">
								<td><i class="el-icon-s-operation font20 h99"></i></td>
								<td class="color1 zmlleft"><router-link class="color1" :to="'/vip/p_policy_detail?id='+item.declarationId">{{item.title}}</router-link></td>
								<td>{{item.createTime}}</td>
								<td class="fen">{{item.materialCount}}{{$t('common.detail.pieces')}}</td>
								<td>
									<span>{{item.cashInTxt}}</span>
								</td>
							</tr>
						</table>
					</div>
					<div class="tipBox" v-if="tableData.length == 0">{{$t('news.listTip')}}</div>
				</div>
			</div>
		</div>
	</div>
</template>
<script>
import {ajaxBackAdd,msg,ajaxAdd,ajax} from '@/utils/js.js';
import { queryPolicyGr,resumeDetail,queryPolicyCountGr } from '@/services/api.js';
const log = console.log;
import info from '@/components/userInfo.vue'
export default {
	components:{
		'v-info':info
	},
	data() {
		return {
			imgUrl: this.$store.state.imgUrl,
			resource: {}, 

			tableData: [],
			sort: 1, //1=默认排序，2=降序 3=升序,
			count:{},
		};
	},
	mounted() {
		this.content();
	},
	watch: {
		'$i18n.locale'() {
			this.content();
		}
	},
	methods: {
		bindChange() {
			if (this.sort == 1) {
				this.sort = 2;
			} else if (this.sort == 2) {
				this.sort = 3;
			} else if (this.sort == 3) {
				this.sort = 1;
			}
			this.getSbList()
		},
		content() {
			ajax(this,queryPolicyCountGr,{enterpriseId:this.$store.state.userInfo.id},res=>{
				this.count = res.data
				console.log(res.data)
				
			},err=>{
				
			})
			//简历详情
			ajaxAdd(this, resumeDetail, {}, res => {
				
				//基本信息
				if (res.data.resource && Object.getOwnPropertyNames(res.data.resource).length > 0) {
					this.resource = res.data.resource;
					log('简历详情11111',res.data.resource)
				}
				this.eduInfos = res.data.eduInfos
				this.projectExps = res.data.projectExps
				this.qualificationList = res.data.qualificationList
				this.workExperiences = res.data.workExperiences
			});
			this.getSbList()
		},
		getSbList() {
			var zmlData = {
				pageNo: 1,
				pageSize: 10, //无需分页
			};
			console.log('zmlData',zmlData)
			ajax(
				this,
				queryPolicyGr,
				zmlData,
				res => {
					console.log(res.data);
					this.tableData = res.data.records;
				},
				err => {
					console.log(err);
				}
			);
		}
	}
};
</script>
<style lang="scss">
.p-policy-content {
	.company-policy-content {
		width: 100%;
		min-height: 690px;
		background-color: #fff;
		margin-top: 20px;
		padding: 0 20px 50px;
		.company-policy-head {
			height: 90px;
			.company-policy-head-num {
				font-size: 16px;
				margin: 0 30px;
				span {
					margin-left: 10px;
					color: #ff7452;
					font-size: 24px;
				}
			}
		}
		.company-release-table {
			margin-top: 12px;
			table {
				width: 100%;
				text-align: center;
				color: #666;
				tr {
					border: 1px solid #ededed;
					height: 50px;
					.cz {
						margin: 0 10px;
						cursor: pointer;
					}
					.fen {
						color: #0f54bc;
						text-decoration: underline;
					}
				}
				tr:nth-of-type(1) {
					background-color: #f2f6fe;
					height: 50px;
					td:nth-of-type(1) {
						text-align: left;
						padding-left: 32px;
						max-width: 250px;
					}
				}
			}
			.zmlchange {
				cursor: pointer;
				user-select: none;
			}
			.zmlleft {
				text-align: left;
				padding-left: 23px;
				width: 250px;
			}
		}
	}
}
</style>
